#!/bin/sh

TOKEN=YzExNWNkZGEtZGUyMi00MGI4LThkN2YtZTVmNDk0MzZkNTll
IMAGE=probezy/cpolar

install_docker_cpolar() {
    docker pull probezy/cpolar
}

remove_cpolar_container() {
    docker stop cpolar
    docker rm cpolar
}

run_cpolar_container() {
    docker run -id \
        --name cpolar \
        --network host \
        -v ./cpolar/cpolar.yml:/usr/local/etc/cpolar/cpolar.yml \
        ${IMAGE}
}

cpolar_authtoken() {
    echo "cpolar_authtoken"
    docker exec -it cpolar /usr/local/bin/cpolar authtoken ${TOKEN}
}

if [ $# -gt 0 ]; then
    command=$1
    ${command}
fi
